//
//  GDMeViewController.m
//  爱新奇－味道
//
//  Created by 热带雨林 on 17/2/19.
//  Copyright © 2017年 热带雨林. All rights reserved.
//

#import "GDMeViewController.h"
#import "GDMineTopView.h"
#import "GDMineTopView.h"
#import "GDMineCell.h"
#import "GDMineQuiteCell.h"
#import "Masonry.h"

static NSString *cellID = @"cell_ID";
static NSString *lastCellID = @"cell_last_ID";

@interface GDMeViewController ()<UITableViewDataSource>
@property(nonatomic, weak)UITableView *tableView;
@property(nonatomic, weak)GDMineTopView *topView;

@end

@implementation GDMeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"账号";
    self.view.backgroundColor = [UIColor grayColor];
}

- (void)setupUI{
    GDMineTopView *topView = [GDMineTopView mineTopView];
    self.topView = topView;
    [self.view addSubview:topView];
    UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    tableView.dataSource = self;
    [self.view addSubview:tableView];
    self.tableView = tableView;
//    tableView.estimatedRowHeight = 60;
//    tableView.rowHeight = UITableViewAutomaticDimension;
    tableView.rowHeight = 60;
    [tableView registerClass:[GDMineCell class] forCellReuseIdentifier:cellID];
    [tableView registerClass:[GDMineQuiteCell class] forCellReuseIdentifier:lastCellID];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(46);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(200);
    }];
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(10);
        make.left.right.bottom.equalTo(self.view);
        
    }];
    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if(section == 0){
        return 1;
    }else if(section == 1){
        return 3;
    }
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if(indexPath.section == 2){
        GDMineQuiteCell *cell = [tableView dequeueReusableCellWithIdentifier:lastCellID];
        return cell;
    }
    
    GDMineCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
